#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import time


app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://pi:wangaicc@127.0.0.1:5432/test'
db = SQLAlchemy(app)


class Kuaidi(db.Model):
    __tablename__ = 'kuaidi'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True, info='编码')
    name = db.Column(db.String, info='收件人名')
    phone = db.Column(db.String, info='收件人手机号码', index=True, unique=True)
    kuaidi_no = db.Column(db.String, info='快递单号')
    kuaidi_ty = db.Column(db.String, info='快递公司', default="ems")
    kdstatus = db.Column(db.String, info='快递目前状态', nullable=True)

    def __init__(self, name, phone, kuaidi_no, kuaidi_ty, kdstatus):
        self.name = name
        self.phone = phone
        self.kuaidi_no = kuaidi_no
        self.ctikuaidi_tyme = kuaidi_ty

    def __repr__(self):
        return "<User %r>" % self.name


class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True, unique=True)
